
// 倒计时
function djs(btn , time) {
    btn.disabled = true ;
    btn.innerHTML = time ;
    var t = setInterval(function(){
        btn.innerHTML-- ;
        if(btn.innerHTML <= 0) {
            clearInterval(t) ;
            btn.disabled = false ;
            btn.innerHTML = '留言'
        }
    } , 200)
}



function get(selector) {
    return document.querySelector(selector)
}



function formatDate() {
    var date = new Date() ;
    var y = date.getFullYear() ;
    var m = date.getMonth() + 1 ;
    var d = date.getDate() ;
    var h = date.getHours() ;
    var min = date.getMinutes() ;
    var s = date.getSeconds() ;
    return y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(min) + ':' + add0(s)
}



function add0(n) {
    return n >= 10 ? n : '0' + n ;
}